#ifndef PHOTOCOPYDIALOG_H
#define PHOTOCOPYDIALOG_H

#include <QDialog>
#include <QSettings>
#include <QDateTime>

#include "overwrite.h"

class QLineEdit;
class QFileInfo;
class QDate;


namespace Ui {
class PhotoCopyDialog;
}

class PhotoCopyDialog : public QDialog
{
    Q_OBJECT
    
    enum Versions
    {
      e_v1, // project created
      e_v2, // date from-to added
      e_LastVersion = e_v2
    };

public:
    explicit PhotoCopyDialog(QWidget *parent = 0);
    ~PhotoCopyDialog();
    
private slots:
    void on_pushButtonFrom_clicked();

    void on_pushButtonTo_clicked();

    void on_pushButtonCopy_clicked();

    void on_checkBoxFromDate_clicked();

    void on_checkBoxToDate_clicked();

protected:
    virtual void showEvent(QShowEvent* event);
    virtual void closeEvent(QCloseEvent* e);

private:
    void        callChooseDirDialog(QLineEdit*& edit, QString caption);
    unsigned    countFiles(QString strDir);
    void        copy(QString strDir);
    void        copyFile(const QString& fileNameIn, const QString& fileName, const QFileInfo& fileinfo);
    void        readSettings();
    void        writeSettings();
    bool        isAppropriateFileDate(const QDateTime &dt);

private:
    Ui::PhotoCopyDialog*             ui;

    QString         m_sFrom; // copy from
    QString         m_sTo;   // copy to
    bool            m_bDateFrom;
    QDateTime       m_dateFrom;
    bool            m_bDateTo;
    QDateTime       m_dateTo;
    unsigned        m_nFile;
    unsigned        m_nAllFiles;
    bool            m_bCreateYear;
    QStringList     m_slExtensions;
    Overwrite       m_overwrite;
    Versions        m_version;
};

#endif // PHOTOCOPYDIALOG_H
